import Config from '../config'
import entranceView from '../views/entranceView.vue'
import componentDocs from '../views/componentDocs/index.vue'
const langTypes = Config.langTypes
const routerGuide = ['introduce', 'start', 'joinLabour']
const routerComponents = [
  'alter',
  'button',
  'card',
  'dropdown',
  'tooltip',
  'icon',
  'tabs',
  'message',
  'grid',
  'backtop',
  'input',
  'tag',
  'select',
  'datePicker',
  'timePicker',
]
const routers = []
const renderRouter = () => {
  langTypes.forEach((lang) => {
    const guideChildrens = []
    const componentChildrens = []
    routerComponents.forEach((routerItem) => {
      componentChildrens.push({
        path: `/${lang}/component/${routerItem}`,
        name: routerItem,
        component: () => import(`../markdown/${lang}/${routerItem}.md`),
      })
    })
    routerGuide.forEach((routerItem) => {
      guideChildrens.push({
        path: `/${lang}/guide/${routerItem}`,
        name: routerItem,
        component: () => import(`../views/${routerItem}/index.vue`),
      })
    })
    routers.push({
      path: `/${lang}/component`,
      component: componentDocs,
      redirect: `/${lang}/component/button`,
      children: componentChildrens,
    })
    routers.push({
      path: `/${lang}/guide`,
      component: entranceView,
      children: guideChildrens,
    })
  })
}
renderRouter()

export default routers
